<template>
  <div class="home">
    <head-nav
      :province='province'
      setCurrYear='setCurrYear'
    ></head-nav>
    <div class="content-box">
      <div class="top-box box-item">
        <project-type-pie class="pie-box"></project-type-pie>
        <project-bar-data class="bar-box"></project-bar-data>
        <province-quantities-pie class="pie-box"></province-quantities-pie>
      </div>
      <div class="box-item">
        <china-map
          @setCurrProvince='setCurrProvince'
          class="map-box"
        ></china-map>
        <scene-monitoring class="window-box"></scene-monitoring>
      </div>
      <div class="bottom-box box-item">
        <province-cost-pie class="pie-box"></province-cost-pie>
        <project-line-data class="bar-box"></project-line-data>
        <prize-type-pie class="pie-box"></prize-type-pie>
      </div>
    </div>
  </div>
</template>

<script>
import HeadNav from "@/components/HeadNav";
import ProjectTypePie from "@/components/ProjectTypePie";
import ProvinceQuantitiesPie from "@/components/ProvinceQuantitiesPie";
import ProvinceCostPie from "@/components/ProvinceCostPie";
import PrizeTypePie from "@/components/PrizeTypePie";

import ChinaMap from "@/components/ChinaMap";
import SceneMonitoring from "@/components/SceneMonitoring";
import ProjectBarData from "@/components/ProjectBarData";
import ProjectLineData from "@/components/ProjectLineData";

export default {
  name: "Home",
  components: {
    HeadNav,
    ProjectTypePie,
    ProvinceQuantitiesPie,
    ProvinceCostPie,
    PrizeTypePie,
    ChinaMap,
    SceneMonitoring,
    ProjectBarData,
    ProjectLineData,
  },
  data() {
    return {
      province: "全国", // 当前区域
      year: new Date(), // 当前年
    };
  },
  created() {},
  methods: {
    //  设置当前省份
    setCurrProvince(province) {
      this.province = province;
    },
    // 设置当前年
    setCurrYear(year) {
      this.year = year;
    },
  },
};
</script>
<style lang="less" scoped>
@import "../common/css/common";
.home {
  width: 100%;
  height: auto;
  box-sizing: border-box;
  margin: 0 auto;
  padding-bottom: 100px;
  background: #f7f9fc;
}
.content-box {
  width: 100%;
  height: auto;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: flex-start;
  padding: 0 24px;
  box-sizing: border-box;
  margin-top: 20px;
  .box-item {
    margin-top: 24px;
    width: 100%;
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: flex-start;
    .pie-box {
      width: 25%;
      height: 200px;
      background: url("../common/imgs/bg.png") no-repeat 50% / cover;
    }
    .bar-box {
      width: 45%;
      height: 200px;
      background: url("../common/imgs/bg.png") no-repeat 50% / cover;
    }
  }
  .map-box,
  .window-box {
    width: 48%;
    height: 300px;
    animation-duration: 1s; /* 动画时间 */
  }
  .map-box {
    animation-name: fadeInLeft; /* 关键帧名字 */
  }
  @keyframes fadeInLeft {
    0% {
      opacity: 0;
      transform: translateX(-600px);
    }

    100% {
      opacity: 1;
      transform: translateX(0px);
    }
  }
  .window-box {
     animation-name: fadeInRight; /* 关键帧名字 */
  }
  @keyframes fadeInRight {
    0% {
      opacity: 0;
      transform: translateX(600px);
    }

    100% {
      opacity: 1;
      transform: translateX(0px);
    }
  }
  .top-box {
    animation-duration: 1s; /* 动画时间 */
    animation-name: fadeInDown; /* 关键帧名字 */
  }
  @keyframes fadeInDown {
    0% {
      opacity: 0;
      transform: translateY(-600px);
    }

    100% {
      opacity: 1;
      transform: translateY(0px);
    }
  }
  .bottom-box {
    animation-duration: 1s;
    animation-name: fadeInUp;
  }
  @keyframes fadeInUp {
    0% {
      opacity: 0;
      transform: translateY(600px);
    }

    100% {
      opacity: 1;
      transform: translateY(0px);
    }
  }
}
.project-bar-data {
  padding-top: 0;
  padding-bottom: 0;
}
::v-deep .el-tabs__header {
  margin: 0;
}
</style>
